package com.niguang.govt.admin.api.controller;


import com.niguang.govt.admin.api.entity.GovtUser;
import com.niguang.govt.admin.api.service.GovtUserService;
import com.niguang.govt.admin.common.pojo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 政府后台用户 前端控制器
 * </p>
 *
 * @author 12380
 * @since 2018-12-13
 */
@RestController
@RequestMapping("/api/govtUser/")
public class GovtUserController {


    @Resource
    private GovtUserService govtUserService;

    /**
     * 用户注册
     *
     * @param govtUser
     * @return
     */
    @PostMapping("open/addUser")
    public Result<Boolean> addUser(@Valid GovtUser govtUser) {
        return govtUserService.addUser(govtUser);
    }


    /**
     * 用户登录
     *
     * @param userAccount
     * @param userPwd
     * @return
     */
    @GetMapping("open/loginUser")
    public Result<GovtUser> loginUser(@RequestParam String userAccount, @RequestParam String userPwd) {
        return govtUserService.loginUser(userAccount, userPwd);
    }


}

